import { createApp } from 'vue'
import App from './App.vue'
import { router } from './router/index'
import element from 'element-plus'
import 'element-plus/theme-chalk/index.css'
const app = createApp(App)

app.use(router);
app.use(element)

// 白名单过滤
router.beforeEach((to,from,next)=>{
    let white=['/login']
    if (white.includes(to.path)){
        next()
    }else{
        // 获取到此用户的资源列表
        let pagelist = localStorage.getItem('pagelist')
        if (pagelist){
            let lst = JSON.parse(pagelist)
            if (lst.includes(to.path)){
                next()
            }else {
                alert('你无权访问')
                return false
            }
        }else {
            alert('你无权访问')
            return false
        }

    }
})



import Vant from 'vant';
import 'vant/lib/index.css';

app.use(Vant);


app.mount('#app')
